  var post={}; 
		 $('#simpan').linkbutton({  
			iconCls: 'disk'  
		 });
		 $('#tutup').linkbutton({  
			iconCls: 'cross'  
		 });
		 $('#tutup').live('click',function(){
			mywindow_close();
		 });
 
 if(sts_form=='toko_user')
 {
		  $('#simpan').bind('click',function(){
				//loadingna();
				jQuery('#form_na').form('submit',{
					url:host+'backend/simpan/tbl_toko_user',
					onSubmit: function(){
						  return $('#form_na').form('validate');
					},
					success:function(r){
						console.log(r);
						var r=eval('(' + r + ')');
						console.log(r.msg);
						if(r.msg==1){
							cek_url('user_toko');
							
							mywindow_close();
							
							$.messager.alert("Simpan Data","Data Sudah Tersimpan",'info');
							
						}
						else{
							mywindow_close();
							$.messager.alert("Simpan Data","Data Gagal Tersimpan",'error');
							//winLoadingClose();
							
						}
						 
					},
					
					error:function(data){
						console.log(r.msg);
						 $.messager.alert("Simpan Data","Data Gagal Tersimpan",'error');
						// winLoadingClose();
						
					}
				});
		  });
 }
 
if(sts_form=='produk_user'){
	
	if(sts=='add'){
		fillCombo(host+'backend/get_combo/cl_warna',"cl_warna_id");
		fillCombo(host+'backend/get_combo/cl_kategori',"cl_kategori_id");
	
	}
	else{		
		fillCombo(host+'backend/get_combo/cl_warna',"cl_warna_id",cl_warna);
		fillCombo(host+'backend/get_combo/cl_kategori',"cl_kategori_id",cl_kategori);	
		
	}
	$('#harga').keyup(function(e){
		this.value = this.value.replace(/\D/g,'');
		this.value = add_koma(this.value);
	});
	
	$('#simpan').bind('click',function(){
		submit_formna(host+'backend/simpan/tbl_produk_user','form_produk_user','user_produk','Data Sudah Tersimpan \n Silahkan Tunggu Persetujuan Dari Admin');
	});
}

 if(sts_form=='tbl_porto_folio')
 {
		
	$('#simpan').bind('click',function(){
		submit_formna(host+'backend/simpan/tbl_porto_folio','form_na','portofolio','Porto Folio Sudah Tersimpan');
	});
	 
 }
 
 if(sts_form=='tbl_narsis')
 {
		
	$('#simpan').bind('click',function(){
		submit_formna(host+'backend/simpan/tbl_narsis','form_na','narsis','Foto Narsis Sudah Tersimpan');
	});
	 
 }
 
 if(sts_form=='cl_warna')
 { 
	$('#simpan').bind('click',function(){
		submit_formna(host+'backend/simpan/cl_warna','form_na','warna','Referensi Warna Sudah Tersimpan');
	});
	 
 }
 
  if(sts_form=='cl_kategori')
 { 
	$('#simpan').bind('click',function(){
		submit_formna(host+'backend/simpan/cl_kategori','form_na','kategori','Referensi Kategori Sudah Tersimpan');
	});
	 
 }
 
 if(sts_form=='tbl_faq')
 { 
	$('#simpan').bind('click',function(){
		submit_formna(host+'backend/simpan/tbl_faq','form_na','faq','Pertanyaan Sudah Terjawab');
	});
	 
 }
 
 if(sts_form=='ubah_pwd')
 { 
	$('#simpan').bind('click',function(){
		if($('#password').val()==$('#password_lagi').val())	{					   
			$.post(host+'backend/simpan/tbl_user',{id:user_id,password:$('#password').val(),sts:'edit'},function(r){
				var r=eval('(' + r + ')');
				if(r.msg==1){
					$.messager.alert("Ubah Password",'Password Telah Di Ubah','info');
					$('#pwd').window('close');
					window.location = host+'login/logout_na2';
				}
				else{$.messager.alert("Ubah Password",r,'info');}
			});
		}
		else{$.messager.alert("Ubah Password",'Password Tidak Sama','info');}
	});
	 
 }
 
 function submit_formna(url,id_form,id_grid,msg){
		if($('#'+id_form).form('validate')){loadingna();}
	 	else{return false;}
		
		jQuery('#'+id_form).form('submit',{
					url:url,
					onSubmit: function(){
						 
					},
					success:function(r){
					console.log(r)
					var r=eval('(' + r + ')');
						//console.log(r.msg)
						if(r.msg==1){
							//cek_url('user_toko');
							winLoadingClose();
							mywindow_close();
							$.messager.alert("Simpan Data",msg,'info');
							$('#'+id_grid).datagrid('reload');
						}
						else{
							winLoadingClose();
							//mywindow_close();
							$.messager.alert("Simpan Data","Data Gagal Tersimpan",'error');
							
							
						}
						 
					},
					
					error:function(data){
						console.log(data)
						 $.messager.alert("Simpan Data","Data Gagal Tersimpan",'error');
						 winLoadingClose();
						
					}
				});
	
 }